﻿using Avalon.Core.Data;
using Avalon.Core.MVC.StateBags;
using System;

namespace Avalon.Core.MVC.Actions {
    public class AnonymousAction<TModel> : IPipelineAction where TModel : class, IEntity, new() {
        private Action<IStateBag> _action;
        public int Index { get; set; }

        public AnonymousAction(int index, Action<IStateBag> action) {
            Index = index;
            _action = action;
        }

        public void Execute(IStateBag stateBag) {
            _action.Invoke(stateBag);
        }
    }
}
